package com.neusoft.yiyang.medical.service.impl;

import com.neusoft.yiyang.common.entity.diet.DietTag;
import com.neusoft.yiyang.common.entity.medical.DrugDict;
import com.neusoft.yiyang.medical.mapper.DrugDictMapper;
import com.neusoft.yiyang.medical.service.DrugDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class DrugDictServiceImpl implements DrugDictService {

    @Autowired
    private DrugDictMapper drugDictMapper;

    @Override
    public void addDrugDict(DrugDict drugDict) {
        drugDictMapper.insert(drugDict);
    }

    @Override
    public List<DrugDict> getAllDrugDicts() {
        return drugDictMapper.selectList(null);
    }

    @Override
    public List<DrugDict> getDrugDictByName(String genericName) {
        return drugDictMapper.selectByGenericName(genericName);
    }

    @Override
    public void updateDrugDict(DrugDict drugDict) {
        drugDictMapper.updateById(drugDict);
    }

    @Override
    public void deleteDrugDict(Integer drugId) {
        drugDictMapper.deleteById(drugId);
    }

    //根据drugId获取药品
    @Override
    public DrugDict getByDrugId(Integer drugId) {
        return drugDictMapper.selectById(drugId);
    }


}
